package com.adteam.xmap.manager.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.adteam.xmap.entity.Academy;
import com.adteam.xmap.manager.AcademyManager;

public class AcademyManagerImpl extends HibernateDaoSupport implements AcademyManager {

	public void addAcademy(Academy academy) {

		getHibernateTemplate().save(academy);
		
	}

	public void delAcademy(int id) {

		getHibernateTemplate().delete(findAcademyById(id));
		
	}

	public Academy findAcademyById(int id) {

		return (Academy)getHibernateTemplate().load(Academy.class, id);
		
	}

	public List findAllAcademys() {

		return getHibernateTemplate().find("select a from Academy a");
		
	}

	public void updateAcademy(Academy academy) {

		getHibernateTemplate().update(academy);
		
	}

}
